﻿using Autodesk.Revit.UI;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ZhuXingFamilys.Help;

namespace ZhuXingFamilys.test
{
    /// <summary>
    /// UserControl1.xaml 的交互逻辑
    /// </summary>
    public partial class FamilyFileCopyFrom : Window
    {
        FamilyFIleConvert FamilyFIleConvert = null;
        ExternalEvent FamilyFIleConvertEvent = null;
        public static string address1;
        public static string rfapath1;
        public static string savepath1;
        public FamilyFileCopyFrom()
        {
            WindowStartupLocation = WindowStartupLocation.CenterScreen;
            InitializeComponent();
            string path = Set.getaddress();
            string paths = System.IO.Path.Combine(path.Substring(0, path.Length), "image\\设置.ico");
            Uri Icon = new Uri(paths, UriKind.Absolute);
            this.Icon = BitmapFrame.Create(Icon);

            FamilyFIleConvert = new FamilyFIleConvert();
            FamilyFIleConvertEvent = ExternalEvent.Create(FamilyFIleConvert);
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog(); //选择文件夹
            openFileDialog.Multiselect = true;//该值确定是否可以选择多个文件
            openFileDialog.Title = "请选择文件";
            openFileDialog.Filter = "Excel文件(*.xls,*.xlsx)|*.xls;*.xlsx";
            //注意，此处一定要手动引入System.Window.Forms空间，否则你如果使用默认的DialogResult会发现没有OK属性
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                address.Text = openFileDialog.FileName;
                address1 = address.Text;


            }

        }

        private void Button_Click2(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void Buttonrfa_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog(); //选择文件夹
            //openFileDialog.Multiselect = true;//该值确定是否可以选择多个文件
            openFileDialog.Title = "请选择族文件";
            openFileDialog.Filter = "族文件(*.rfa,*.rvt)|*.rfa;*.rvt";
            //注意，此处一定要手动引入System.Window.Forms空间，否则你如果使用默认的DialogResult会发现没有OK属性
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                rfaaddress.Text = openFileDialog.FileName;
                rfapath1 = rfaaddress.Text;

            }
        }
        public static string Getpathaddress1()
        {

            return address1;
        }


        public static string Getpathrfapath1()
        {

            return rfapath1;
        }

        public static string Getsavepath()
        {

            return savepath1;
        }

        private void Buttonsave_Click(object sender, RoutedEventArgs e)
        {

            FolderBrowserDialog openFileDialog = new FolderBrowserDialog(); //选择文件夹
            //注意，此处一定要手动引入System.Window.Forms空间，否则你如果使用默认的DialogResult会发现没有OK属性
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                savefilepath.Text = openFileDialog.SelectedPath;
                savepath1 = savefilepath.Text;
            }

        }
    }
}
